package cn.lml.lession.user.service.impl;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.lml.lession.user.dao.ModuleMapper;
import cn.lml.lession.user.model.Module;
import cn.lml.lession.user.service.ModuleService;

@Service
public class ModuleServiceImpl implements ModuleService{

	private static final Logger logger=LoggerFactory.getLogger(ModuleServiceImpl.class);	
	@Autowired
	private ModuleMapper moduleMapper;

	@Override
	public Integer insertModule (Module module){
		logger.debug("新增数据 "+module);
		return moduleMapper.insertModule(module);
	}

	@Override
	public Integer deleteByMid (Integer mid){
		logger.debug("通过Mid删除数据 "+mid);
		return moduleMapper.deleteByMid(mid);
	}

	@Override
	public Integer updateByMid (Module module){
		logger.debug("通过Mid修改数据 "+module);
		return moduleMapper.updateByMid(module);
	}

	@Override
	public Module selectByMid (Integer mid){
		logger.debug("通过Mid查找数据 "+mid);
		return moduleMapper.selectByMid(mid);
	}

	@Override
	public List<Module> queryModule(Map<String, Object> cond) {
		logger.debug("分页查询数据 "+cond);
		return moduleMapper.queryModule(cond);
	}

	@Override
	public Integer countModule(Map<String, Object> cond) {
		logger.debug("统计数据 "+cond);
		return moduleMapper.countModule(cond);
	}

	@Override
	public List<Module> queryModuleByRoleId(Integer rid) {
		return moduleMapper.queryModuleByRoleId(rid);
	}

}